package net.towee.client.event.core;

import net.towee.model.account.AccountIdentity;
import net.towee.model.account.Role;

import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.GwtEvent.Type;

public class UserRoleChangedEvent extends GwtEvent<UserRoleChangedHandler> {
	public static Type<UserRoleChangedHandler> TYPE = new Type<UserRoleChangedHandler>();
	
	private final Role role;
	private final String groupId;
	private final String userId;

	public UserRoleChangedEvent(Role role, String userId, String groupId) {
		this.role = role;
		this.groupId = groupId;
		this.userId = userId;
	}

	@Override
	public Type<UserRoleChangedHandler> getAssociatedType() {
		return TYPE;
	}

	@Override
	protected void dispatch(UserRoleChangedHandler handler) {
		handler.onUserRoleChanged(role, userId, groupId);
	}

}
